<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>从文件中加载一个 PostScript Type 1 字体</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.imagepsfreefont.html">imagepsfreefont</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.imagepsslantfont.html">imagepsslantfont</a></div>
 <div class="up"><a href="ref.image.html">GD and Image 函数</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="function.imagepsloadfont" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">imagepsloadfont</h1>
  <p class="verinfo">(PHP 4, PHP 5)</p><p class="refpurpose"><span class="refname">imagepsloadfont</span> &mdash; <span class="dc-title">从文件中加载一个 PostScript Type 1 字体</span></p>

 </div>
 <div class="refsect1 description" id="refsect1-function.imagepsloadfont-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="type">resource</span> <span class="methodname"><strong>imagepsloadfont</strong></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$filename</code></span>
   )</div>

  <p class="para rdfs-comment">
   从文件 <em><code class="parameter">filename</code></em> 中加载一个 PostScript Type 1 字体。
  </p>
 </div>

 <div class="refsect1 parameters" id="refsect1-function.imagepsloadfont-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>

    
     <dt>
<em><code class="parameter">filename</code></em></dt>

     <dd>

      <p class="para">
       Postscript 字体文件的路径。
      </p>
     </dd>

    
   </dl>

  </p>
 </div>

 <div class="refsect1 returnvalues" id="refsect1-function.imagepsloadfont-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   如果一切正常，将返回一个合法的字体索引以备使用。否则返回
   <strong><code>FALSE</code></strong> 并显示一条信息说明哪里错了，但不能直接读取此信息，因为输出格式是图像。  </p>
 </div>

 <div class="refsect1 examples" id="refsect1-function.imagepsloadfont-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="example-3186">
    <p><strong>Example #1 <span class="function"><strong>imagepsloadfont()</strong></span> 例子</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /></span><span style="color: #FF8000">//&nbsp;Create&nbsp;a&nbsp;new&nbsp;image&nbsp;instance<br /></span><span style="color: #0000BB">$im&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">imagecreatetruecolor</span><span style="color: #007700">(</span><span style="color: #0000BB">350</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">45</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">//&nbsp;Allocate&nbsp;colors&nbsp;and&nbsp;fill&nbsp;the&nbsp;background<br /></span><span style="color: #0000BB">$black&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">imagecolorallocate</span><span style="color: #007700">(</span><span style="color: #0000BB">$im</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$white&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">imagecolorallocate</span><span style="color: #007700">(</span><span style="color: #0000BB">$im</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">255</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">255</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">255</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">imagefilledrectangle</span><span style="color: #007700">(</span><span style="color: #0000BB">$im</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">349</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">44</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$white</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">//&nbsp;Load&nbsp;a&nbsp;font,&nbsp;write&nbsp;to&nbsp;the&nbsp;image&nbsp;and&nbsp;free&nbsp;the&nbsp;font&nbsp;from&nbsp;memory<br /></span><span style="color: #0000BB">$font&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">imagepsloadfont</span><span style="color: #007700">(</span><span style="color: #DD0000">"bchbi.pfb"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">imagepstext</span><span style="color: #007700">(</span><span style="color: #0000BB">$im</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"Testing...&nbsp;It&nbsp;worked!"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$font</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">32</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$white</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$black</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">32</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">32</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">imagepsfreefont</span><span style="color: #007700">(</span><span style="color: #0000BB">$font</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">//&nbsp;Output&nbsp;the&nbsp;image<br /></span><span style="color: #0000BB">header</span><span style="color: #007700">(</span><span style="color: #DD0000">'Content-type:&nbsp;image/png'</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">imagepng</span><span style="color: #007700">(</span><span style="color: #0000BB">$im</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">imagedestroy</span><span style="color: #007700">(</span><span style="color: #0000BB">$im</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

   </div>
  </p>
 </div>

 <div class="refsect1 notes" id="refsect1-function.imagepsloadfont-notes">
  <h3 class="title">注释</h3>
  <blockquote class="note"><p><strong class="note">Note</strong>: <span class="simpara">此函数仅在 PHP
编译时指定了 <strong class="option configure">--with-t1lib[=DIR]</strong>
 时可用。</span></p></blockquote>
 </div>

 <div class="refsect1 seealso" id="refsect1-function.imagepsloadfont-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><span class="function"><a href="function.imagepsfreefont.html" class="function" rel="rdfs-seeAlso">imagepsfreefont()</a> - 释放一个 PostScript Type 1 字体所占用的内存</span></li>
   </ul>
  </p>
 </div>

</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.imagepsfreefont.html">imagepsfreefont</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.imagepsslantfont.html">imagepsslantfont</a></div>
 <div class="up"><a href="ref.image.html">GD and Image 函数</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>
